import { createSSRApp } from 'vue';
import App from './App.vue';
import uviewPlus from 'uview-plus';

import { setupStore } from './store/index';
import directives from '@/directives/index';
// #ifndef MP-WEIXIN
import showMsg from '@/tsx/message';

// #endif
//import { createRouter } from 'uni-mini-router';
// 创建路由实例
// const router = createRouter({
// 	routes: [
// 		{ path: '/pages/login/login', component: () => import('@/pages/login/login.vue') },
// 		{ path: '/pages/index/index', component: () => import('@/pages/index/index.vue') },
// 		{ path: '/pages/profile/edit', component: () => import('@/pages/profile/edit.vue') },
// 	],
// });
export function createApp() {
	const app = createSSRApp(App);
	app.use(uviewPlus);

	app.use(directives);
	app.config.globalProperties.$u = uviewPlus;
	//app.use(router);
	setupStore(app);
	// #ifndef MP-WEIXIN
	app.config.globalProperties['$msg'] = {
		show(msg: string, click: number) {
			showMsg(msg, click);
		},
	};
	// #endif
	return {
		app,
	};
}
